<template>
  <globle-dialog ref="globleDialogRef" :title="globleDialogConfig.title" :btn="{isShowBtn:false}" @onBeforeColse="onBeforeColse">
    <globle-form ref="globleFormRef" :bindData="globleFormConfig.bindData"
      :itemConfig="globleFormConfig.itemConfig"></globle-form>
  </globle-dialog>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue';
import { formType, IGlobleFormProps } from '../../../components/form/type';

const globleDialogRef = ref();
const globleFormRef = ref();
const globleDialogConfig = { title: '课程详情' };
const globleFormConfig: IGlobleFormProps = reactive({
  bindData: {} as any,
  itemConfig: [
    { type: formType.input, label: '学年', prop: 'schoolYear' },
    { type: formType.input, label: '学期', prop: 'stage' },
    { type: formType.input, label: '年级', prop: 'grade' },
    { type: formType.input, label: '课程代码', prop: 'courseCode' },
    { type: formType.input, label: '课程名称', prop: 'courseName' },
    { type: formType.input, label: '教师名称', prop: 'tchName' },
    { type: formType.input, label: '教学班', prop: 'teachClass' },
    { type: formType.input, label: '星期', prop: 'weekDay' },
    { type: formType.input, label: '序号', prop: 'orderNum' },
    { type: formType.input, label: '周数', prop: 'week' },
    { type: formType.input, label: '课程名称', prop: 'place'},
    { type: formType.input, label: '开课类型', prop: 'courseType' },
    { type: formType.input, label: '学时类型', prop: 'classHourType'},
    { type: formType.input, label: '学分', prop: 'credit' },
    { type: formType.input, label: '总学时', prop: 'totalHours' },
    { type: formType.input, label: '任务人数', prop: 'maxPerson' },
    { type: formType.input, label: '已选人数', prop: 'selectedNum' },
    { type: formType.input, label: '地点', prop: 'place' },
    { type: formType.textarea, label: '面向对象', prop: 'allowBand',width: 512 },
  ],
});

const openByCheck = (row: any) => {
  globleDialogRef.value.isShowDialog = true;
  globleFormConfig.bindData = row;
  // console.log('11',globleFormConfig.bindData);
};

const onBeforeColse = () => {
  globleDialogRef.value.isShowDialog = false;
};

defineExpose({ openByCheck });
</script>

<style scoped></style>
